package courseScheduler;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJPanel.java
 *
 * Created on Apr 14, 2011, 2:09:58 PM
 */

/**
 *
 * @author lyn5023
 */
public class SimpleLoginPanel extends javax.swing.JPanel {

  


    /** Creates new form NewJPanel */
    public SimpleLoginPanel(MainThread newParent) {
        initComponents();
        Config configFile=new Config();
        String[] args=new String[3];
        args=configFile.recoverConfigFile();
        if(!(configFile.recoverConfigFile()==null)){
            txtUserNameInput.setText(args[1]);
            txtPasswordInput.setText(args[2]);
        }
        else{
            args=null;
            configFile=null;
            System.gc();
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        txtUserNameDisplay = new javax.swing.JTextField();
        txtUserNameInput = new javax.swing.JTextField();
        txtPasswordDisplay = new javax.swing.JTextField();
        txtPasswordInput = new javax.swing.JPasswordField();
        chkAdvanced = new javax.swing.JCheckBox();
        btnOk = new javax.swing.JButton();
        btnClear = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();

        txtUserNameDisplay.setBackground(new java.awt.Color(192, 192, 192));
        txtUserNameDisplay.setText("User Name");

        txtPasswordDisplay.setBackground(new java.awt.Color(192, 192, 192));
        txtPasswordDisplay.setText("Password");

        chkAdvanced.setText("Advanced");
        chkAdvanced.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                chkAdvancedMouseClicked(evt);
            }
        });

        btnOk.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnOk.setText("OK");

        btnClear.setText("Clear");

        btnCancel.setText("Cancel");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(53, 53, 53)
                        .addComponent(btnOk)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnClear)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCancel))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(chkAdvanced)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtPasswordDisplay)
                                    .addComponent(txtUserNameDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(36, 36, 36)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtPasswordInput)
                                    .addComponent(txtUserNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(54, 54, 54)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtUserNameDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtUserNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPasswordDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPasswordInput, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(chkAdvanced)
                .addGap(56, 56, 56)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnOk)
                    .addComponent(btnClear)
                    .addComponent(btnCancel))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void chkAdvancedMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chkAdvancedMouseClicked
        

    }//GEN-LAST:event_chkAdvancedMouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnClear;
    private javax.swing.JButton btnOk;
    private javax.swing.JCheckBox chkAdvanced;
    private javax.swing.JTextField txtPasswordDisplay;
    private javax.swing.JPasswordField txtPasswordInput;
    private javax.swing.JTextField txtUserNameDisplay;
    private javax.swing.JTextField txtUserNameInput;
    // End of variables declaration//GEN-END:variables

    MainThread parent;
}
